package com.intelligence.tio.server;

import java.io.IOException;

import org.tio.server.AioServer;
import org.tio.server.ServerGroupContext;
import org.tio.server.intf.ServerAioHandler;
import org.tio.server.intf.ServerAioListener;

import com.intelligence.tio.common.Const;
import com.intelligence.tio.common.JsonPacket;
import com.intelligence.tio.common.TioSessionContext;

/**
 * 
 * @author tanyaowu 
 * 2017年3月27日 上午12:16:31
 */
public class TioServerStarter
{
	static ServerAioHandler<TioSessionContext, JsonPacket, Object> aioHandler = new TioServerAioHandler();
	static ServerAioListener<TioSessionContext, JsonPacket, Object> aioListener = new TioServerAioListener();
	static ServerGroupContext<TioSessionContext, JsonPacket, Object> serverGroupContext = new ServerGroupContext<>(aioHandler, aioListener);
	static AioServer<TioSessionContext, JsonPacket, Object> aioServer = new AioServer<>(serverGroupContext); //可以为空
	
	static String serverIp = null;
	static int serverPort = Const.PORT;

	public static void main(String[] args) throws IOException
	{

		 new PolicyServer().startPolicy();
		 aioServer.start(serverIp, serverPort);
	}
}